library(readxl)
library(ggplot2)
library(dplyr)
library(knitr)
library(tidyverse)
library(forecast)
library(vars)
library(gridExtra)
library(corrplot)
data = head(data, 56)
head(data)
| Date | CDS of Turkey (5yr) | Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate) | USDTRY | Turkey Average Deposit Rate (1m) | Turkey Implied Yield (1-month, %) | Turkey CPI (%YoY) | Turkey 12-month ahead inflation expectations | Average CDS of Emerging Markets (5yr) | VIX | ⋯ | Turkey GDP Level (SWDA) | Turkey GDP Growth (%YoY, NSA) | Turkey 2yr Bond Yield | Turkey 5yr Bond Yield | Turkey 10yr Bond Yield | Turkey Average Commercial Loan Rate | Turkey Average Consumer Loan Rate | Turkey CPI based REER | Turkey Household Total FX Deposits (US$ bn) | Turkey Corporates Total FX Deposits (US$ bn) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <dttm> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | ⋯ | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> |
| 2006-03-01 | 143.966 | 13.50 | 1.3330 | 14.38 | 13.209 | 8.08 | 5.47 | 83.180 | 12.04 | ⋯ | 96.88 | 6.45 | 13.67 | 13.15 | NA | 16.81 | 17.26 | 171.90 | 43969.01 | 17387.77 |
| 2006-06-01 | 197.459 | 13.83 | 1.4631 | 14.39 | 14.159 | 9.60 | 5.98 | 201.525 | 14.53 | ⋯ | 99.83 | 9.37 | 16.24 | 16.14 | NA | 16.84 | 17.57 | 155.80 | 43078.69 | 17170.67 |
| 2006-09-01 | 221.261 | 17.50 | 1.4989 | 17.48 | 18.617 | 10.83 | 7.84 | 153.068 | 13.61 | ⋯ | 99.08 | 5.96 | 19.93 | 18.50 | NA | 19.85 | 25.15 | 151.46 | 45564.84 | 17500.41 |
| 2006-12-01 | 182.813 | 17.50 | 1.4554 | 17.88 | 18.851 | 9.83 | 7.23 | 120.581 | 11.03 | ⋯ | 101.32 | 6.16 | 21.34 | 19.82 | NA | 20.22 | 23.77 | 157.97 | 50029.46 | 20544.16 |
| 2007-03-01 | 168.769 | 17.50 | 1.4109 | 17.88 | 18.408 | 10.32 | 6.81 | 106.587 | 12.56 | ⋯ | 103.16 | 8.20 | 20.12 | 19.12 | NA | 19.43 | 23.00 | 163.42 | 55046.61 | 22513.14 |
| 2007-06-01 | 152.005 | 17.50 | 1.3382 | 17.70 | 18.336 | 9.52 | 6.58 | 101.420 | 13.73 | ⋯ | 103.20 | 3.23 | 18.73 | 17.50 | NA | 19.19 | 21.32 | 169.99 | 60139.21 | 24147.91 |
column_names <- colnames(data)
print(column_names)
[1] "Date" [2] "CDS of Turkey (5yr)" [3] "Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)" [4] "USDTRY" [5] "Turkey Average Deposit Rate (1m)" [6] "Turkey Implied Yield (1-month, %)" [7] "Turkey CPI (%YoY)" [8] "Turkey 12-month ahead inflation expectations" [9] "Average CDS of Emerging Markets (5yr)" [10] "VIX" [11] "10yr BAA Spread" [12] "US 10yr Treasury Bond Yield" [13] "US 2yr Treasury Bond Yield" [14] "US Policy Rate" [15] "US CPI (%YoY)" [16] "Fed and ECB Balance Sheet Total Size (US$ bn)" [17] "Current Account Balance" [18] "Identified Inflows" [19] "Financial Account Inflows" [20] "Foreign Direct Investment inflows" [21] "Portfolio Inflows" [22] "Other Investment Net Inflows" [23] "Errors and Ommissions" [24] "Reserve Assets" [25] "Turkey Nominal GDP (USD bn)" [26] "Turkey GDP Level (SWDA)" [27] "Turkey GDP Growth (%YoY, NSA)" [28] "Turkey 2yr Bond Yield" [29] "Turkey 5yr Bond Yield" [30] "Turkey 10yr Bond Yield" [31] "Turkey Average Commercial Loan Rate" [32] "Turkey Average Consumer Loan Rate" [33] "Turkey CPI based REER" [34] "Turkey Household Total FX Deposits (US$ bn)" [35] "Turkey Corporates Total FX Deposits (US$ bn)"
a) Study the historical data of real policy rate (average, min, max, etc.) using
# ex-post real policy rate
data$ExPostRealPolicyRate <- data$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)` - data$`Turkey CPI (%YoY)`
# ex-ante real policy rate
data$ExAnteRealPolicyRate <- data$`Turkey 12-month ahead inflation expectations` - data$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`
# statistics of ex-post
exPostRealPolicyRateMean = mean(data$ExPostRealPolicyRate, na.rm = TRUE)
exPostRealPolicyRateMin = min(data$ExPostRealPolicyRate, na.rm = TRUE)
exPostRealPolicyRateMax = max(data$ExPostRealPolicyRate, na.rm = TRUE)
# statistics of ex-ante
exAnteRealPolicyRateMean = mean(data$ExAnteRealPolicyRate, na.rm = TRUE)
exAnteRealPolicyRateMin = min(data$ExAnteRealPolicyRate, na.rm = TRUE)
exAnteRealPolicyRateMax = max(data$ExAnteRealPolicyRate, na.rm = TRUE)
print("Real Policy Rate Mean of Expost:")
print(exPostRealPolicyRateMean)
print("Real Policy Rate Min of Expost:")
print(exPostRealPolicyRateMin)
print("Real Policy Rate Max of Expost:")
print(exPostRealPolicyRateMax)
print("Real Policy Rate Mean of ExAnte:")
print(exAnteRealPolicyRateMean)
print("Real Policy Rate Min of ExAnte:")
print(exAnteRealPolicyRateMin)
print("Real Policy Rate Max of ExAnte:")
print(exAnteRealPolicyRateMax)
[1] "Real Policy Rate Mean of Expost:" [1] -2.140441 [1] "Real Policy Rate Min of Expost:" [1] -67.74 [1] "Real Policy Rate Max of Expost:" [1] 10.28 [1] "Real Policy Rate Mean of ExAnte:" [1] -1.968971 [1] "Real Policy Rate Min of ExAnte:" [1] -11.13 [1] "Real Policy Rate Max of ExAnte:" [1] 26.26
# PLOTTİNG
exAnteRealPolicyRate = data.frame(Statistic = c("Mean", "Min", "Max"),
Value = c(exAnteRealPolicyRateMean, exAnteRealPolicyRateMin, exAnteRealPolicyRateMax),
Method = "Ex-Ante")
exPostRealPolicyRate = data.frame(Statistic = c("Mean", "Min", "Max"),
Value = c(exPostRealPolicyRateMean, exPostRealPolicyRateMin, exPostRealPolicyRateMax),
Method = "Ex-Post")
combinedData = rbind(exAnteRealPolicyRate, exPostRealPolicyRate)
ggplot(combinedData, aes(x = Statistic, y = Value, fill = Method)) +
geom_bar(stat = "identity", width = 0.5, position = position_dodge()) +
labs(title = "Ex-Ante and Ex-Post Real Policy Rate",
x = "Statistic",
y = "Value",
fill = "Method") +
theme_minimal()
This will create a bar chart with six bars representing the mean, minimum, and maximum values of the ex-ante and ex-post real policy rates side by side. The different colors represent the two different methods of estimation: ex-ante (based on 12-month ahead inflation expectations) and ex-post (based on actual inflation).
The ex-ante and ex-post values may differ, as ex-ante values are based on expectations and ex-post values are based on actual outcomes. This can reflect differences between expected and realized inflation, and how central banks adjust their policy rates accordingly.
The mean value for ex-ante and ex-post real policy rates $(-1.968971\ and -2.140441, respectively)$ represents the average of the rates based on the corresponding methods.
These values can provide insights into the average level of the real policy rate over time.
The minimum and maximum values for ex-ante and ex-post real policy rates represent the lowest and highest rates observed in the data, respectively. These values can provide insights into the variability and range of the real policy rate based on the different estimation methods.
Comparing the $ex-ante$ and $ex-post$ values can help assess the accuracy of inflation expectations and the effectiveness of monetary policy actions in responding to actual inflation outcomes. It may also provide insights into the dynamics of inflation and how central banks manage their policy rates in response to changing economic conditions.$
data_subset = data[, c("Date", "Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)",
"US Policy Rate", "Turkey CPI (%YoY)", "US CPI (%YoY)")]
# real interest rates by subtracting inflation rates
data_subset$Turkey_Real_Rate = data_subset$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)` - data_subset$`Turkey CPI (%YoY)`/100
data_subset$US_Real_Rate = data_subset$`US Policy Rate` - data_subset$`US CPI (%YoY)`/100
# Plotting
ggplot(data_subset, aes(x = Date)) +
geom_line(aes(y = Turkey_Real_Rate, color = "Turkey"), size = 1.2) +
geom_line(aes(y = US_Real_Rate, color = "USA"), size = 1.2) +
labs(title = "Real Interest Rates: Turkey vs. USA",
x = "Date", y = "Real Interest Rate") +
scale_color_manual(name = "Country", values = c(Turkey = "blue", USA = "red")) +
theme_minimal()
head(data_subset)
| Date | Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate) | US Policy Rate | Turkey CPI (%YoY) | US CPI (%YoY) | Turkey_Real_Rate | US_Real_Rate |
|---|---|---|---|---|---|---|
| <dttm> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> |
| 2006-03-01 | 13.50 | 4.46 | 8.08 | 3.6 | 13.4192 | 4.424 |
| 2006-06-01 | 13.83 | 4.91 | 9.60 | 4.0 | 13.7340 | 4.870 |
| 2006-09-01 | 17.50 | 5.25 | 10.83 | 3.3 | 17.3917 | 5.217 |
| 2006-12-01 | 17.50 | 5.25 | 9.83 | 1.9 | 17.4017 | 5.231 |
| 2007-03-01 | 17.50 | 5.26 | 10.32 | 2.4 | 17.3968 | 5.236 |
| 2007-06-01 | 17.50 | 5.25 | 9.52 | 2.7 | 17.4048 | 5.223 |
turkey_real_interest_rate = data$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`
usa_real_interest_rate = data$`US Policy Rate`
turkey_real_interest_rate = ts(data$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`, frequency = 12)
usa_real_interest_rate = ts(data$`US Policy Rate`, frequency = 12)
# Combine the time series objects into a data frame
interest_rate_data = data.frame(Turkey = turkey_real_interest_rate, USA = usa_real_interest_rate)
na.omit(interest_rate_data)
interest_rate_data = na.omit(interest_rate_data)
| Turkey | USA | |
|---|---|---|
| <dbl> | <dbl> | |
| 1 | 13.50 | 4.46 |
| 2 | 13.83 | 4.91 |
| 3 | 17.50 | 5.25 |
| 4 | 17.50 | 5.25 |
| 5 | 17.50 | 5.26 |
| 6 | 17.50 | 5.25 |
| 7 | 17.42 | 5.07 |
| 8 | 16.25 | 4.50 |
| 9 | 15.33 | 3.18 |
| 10 | 15.75 | 2.09 |
| 11 | 16.75 | 1.94 |
| 12 | 16.00 | 0.51 |
| 13 | 11.67 | 0.18 |
| 14 | 9.25 | 0.18 |
| 15 | 7.75 | 0.16 |
| 16 | 6.58 | 0.12 |
| 17 | 6.50 | 0.13 |
| 18 | 7.00 | 0.19 |
| 19 | 7.00 | 0.19 |
| 20 | 6.83 | 0.19 |
| 21 | 6.31 | 0.16 |
| 22 | 6.26 | 0.09 |
| 23 | 5.96 | 0.08 |
| 24 | 6.84 | 0.07 |
| 25 | 8.22 | 0.10 |
| 26 | 9.23 | 0.15 |
| 27 | 7.02 | 0.14 |
| 28 | 5.68 | 0.16 |
| 29 | 5.57 | 0.14 |
| 30 | 5.12 | 0.12 |
| ⋮ | ⋮ | ⋮ |
| 39 | 8.66 | 0.14 |
| 40 | 8.78 | 0.16 |
| 41 | 8.98 | 0.36 |
| 42 | 8.50 | 0.37 |
| 43 | 7.98 | 0.40 |
| 44 | 7.98 | 0.45 |
| 45 | 10.10 | 0.70 |
| 46 | 11.80 | 0.95 |
| 47 | 11.97 | 1.15 |
| 48 | 12.17 | 1.20 |
| 49 | 12.75 | 1.45 |
| 50 | 14.82 | 1.74 |
| 51 | 19.29 | 1.92 |
| 52 | 24.00 | 2.22 |
| 53 | 24.07 | 2.40 |
| 54 | 24.34 | 2.40 |
| 55 | 20.31 | 2.19 |
| 56 | 14.04 | 1.64 |
| 57 | 10.72 | 1.26 |
| 58 | 8.31 | 0.06 |
| 59 | 9.04 | 0.09 |
| 60 | 14.04 | 0.09 |
| 61 | 17.23 | 0.08 |
| 62 | 19.00 | 0.07 |
| 63 | 18.95 | 0.09 |
| 64 | 15.92 | 0.08 |
| 65 | 14.00 | 0.12 |
| 66 | 14.00 | 0.77 |
| 67 | 13.47 | 2.19 |
| 68 | 10.32 | 3.65 |
var_model = VAR(interest_rate_data, p = 2)
summary(var_model)
VAR Estimation Results:
=========================
Endogenous variables: Turkey, USA
Deterministic variables: const
Sample size: 66
Log Likelihood: -134.977
Roots of the characteristic polynomial:
0.833 0.833 0.8304 0.8304
Call:
VAR(y = interest_rate_data, p = 2)
Estimation results for equation Turkey:
=======================================
Turkey = Turkey.l1 + USA.l1 + Turkey.l2 + USA.l2 + const
Estimate Std. Error t value Pr(>|t|)
Turkey.l1 1.50543 0.10498 14.340 < 2e-16 ***
USA.l1 -0.01817 0.50662 -0.036 0.97151
Turkey.l2 -0.68337 0.10377 -6.586 1.19e-08 ***
USA.l2 0.27191 0.49128 0.553 0.58195
const 1.75909 0.51402 3.422 0.00111 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.501 on 61 degrees of freedom
Multiple R-Squared: 0.9174, Adjusted R-squared: 0.912
F-statistic: 169.5 on 4 and 61 DF, p-value: < 2.2e-16
Estimation results for equation USA:
====================================
USA = Turkey.l1 + USA.l1 + Turkey.l2 + USA.l2 + const
Estimate Std. Error t value Pr(>|t|)
Turkey.l1 0.006169 0.023194 0.266 0.791
USA.l1 1.625962 0.111935 14.526 < 2e-16 ***
Turkey.l2 -0.001895 0.022927 -0.083 0.934
USA.l2 -0.699313 0.108545 -6.443 2.08e-08 ***
const 0.035866 0.113569 0.316 0.753
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.3317 on 61 degrees of freedom
Multiple R-Squared: 0.9566, Adjusted R-squared: 0.9538
F-statistic: 336.3 on 4 and 61 DF, p-value: < 2.2e-16
Covariance matrix of residuals:
Turkey USA
Turkey 2.25344 0.08996
USA 0.08996 0.11000
Correlation matrix of residuals:
Turkey USA
Turkey 1.0000 0.1807
USA 0.1807 1.0000
The residual standard errors for both equations are also provided, which indicate the average residual standard deviation of the model's predictions. The multiple R-squared and adjusted $R-squared$ values provide information on the overall goodness-of-fit of the model, with higher values indicating better fit. The $F-statistic$ and its associated $p-value$ test the overall significance of the model, with lower $p-values$ indicating that the model is statistically significant. Finally, the covariance matrix of residuals and the correlation matrix of residuals provide information on the estimated covariance and correlation among the residuals of the variables, respectively.
$$USA$$The coefficient estimate for the lag 1 of $USA$ is $1.625962$ with a standard error of $0.111935$. The $p-value$ is very small (less than 0.001), indicating that the coefficient is statistically significant at conventional significance levels
The coefficient estimate for the lag $2$ of Turkey is $-0.001895$ with a standard error of $0.022927$. The p-value is not statistically significant $(p > 0.05)$, indicating that the coefficient is not statistically different from $zero$.
$$TURKEY$$the coefficient estimate for the lag $2$ of $USA$ is $0.27191$ with a standard error of $0.49128$. The p-value is not statistically significant $(p > 0.05)$, indicating that the coefficient is not statistically different from $zero$.
The coefficient estimate for the lag $1$ of $USA$ is $-0.01817$ with a standard error of $0.50662$. The p-value is not statistically significant $(p > 0.05)$, indicating that the coefficient is not statistically different from $zero$.
plot(var_model)
var_model$varresult$coefficients
# variables to shocks
irf <- irf(var_model, impulse = "Turkey", response = "USA", n.ahead = 10)
irf
Impulse response coefficients
$Turkey
USA
[1,] 0.05992674
[2,] 0.10669869
[3,] 0.14266912
[4,] 0.16781453
[5,] 0.18138819
[6,] 0.18309353
[7,] 0.17368559
[8,] 0.15505883
[9,] 0.12996824
[10,] 0.10156111
[11,] 0.07288082
Lower Band, CI= 0.95
$Turkey
USA
[1,] 0.006483447
[2,] -0.004159124
[3,] -0.043013973
[4,] -0.083595360
[5,] -0.107407283
[6,] -0.161020411
[7,] -0.210671056
[8,] -0.238149197
[9,] -0.275074622
[10,] -0.265454550
[11,] -0.254928059
Upper Band, CI= 0.95
$Turkey
USA
[1,] 0.1388045
[2,] 0.2546378
[3,] 0.3287335
[4,] 0.4046357
[5,] 0.4629494
[6,] 0.4942153
[7,] 0.5338276
[8,] 0.5085126
[9,] 0.4813156
[10,] 0.4356660
[11,] 0.3464817
forecast = predict(var_model, n.ahead = 10)
forecast
$Turkey
fcst lower upper CI
[1,] 8.619309 5.677120 11.56150 2.942190
[2,] 8.593627 3.277980 13.90927 5.315647
[3,] 9.936308 2.851207 17.02141 7.085101
[4,] 12.063086 3.875787 20.25039 8.187299
[5,] 14.337633 5.566131 23.10913 8.771502
[6,] 16.233375 7.163725 25.30302 9.069650
[7,] 17.420316 8.139896 26.70074 9.280420
[8,] 17.783653 8.282171 27.28513 9.501482
[9,] 17.392031 7.657028 27.12704 9.735004
[10,] 16.437449 6.495823 26.37908 9.941626
$USA
fcst lower upper CI
[1,] 4.477265 3.8272041 5.127325 0.6500605
[2,] 4.796848 3.5530499 6.040646 1.2437983
[3,] 4.741027 2.9604106 6.521643 1.7806162
[4,] 4.435106 2.2088497 6.661362 2.2262562
[5,] 3.987301 1.4147028 6.559900 2.5725983
[6,] 3.483122 0.6567845 6.309460 2.8263377
[7,] 2.983885 -0.0177726 5.985543 3.0016579
[8,] 2.528453 -0.5869822 5.643887 3.1154347
[9,] 2.137051 -1.0471369 5.321238 3.1841875
[10,] 1.816031 -1.4062738 5.038337 3.2223053
# Subset the data to relevant columns
data_subset = head(data, 56)[, c("Date", "Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)",
"Turkey Average Deposit Rate (1m)", "Turkey Implied Yield (1-month, %)", "Turkey 2yr Bond Yield",
"Turkey 5yr Bond Yield", "Turkey 10yr Bond Yield")]
#data_subset = data_subset[complete.cases(data_subset), ]
data_subset
| Date | Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate) | Turkey Average Deposit Rate (1m) | Turkey Implied Yield (1-month, %) | Turkey 2yr Bond Yield | Turkey 5yr Bond Yield | Turkey 10yr Bond Yield |
|---|---|---|---|---|---|---|
| <dttm> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> |
| 2006-03-01 | 13.50 | 14.38 | 13.209 | 13.67 | 13.15 | NA |
| 2006-06-01 | 13.83 | 14.39 | 14.159 | 16.24 | 16.14 | NA |
| 2006-09-01 | 17.50 | 17.48 | 18.617 | 19.93 | 18.50 | NA |
| 2006-12-01 | 17.50 | 17.88 | 18.851 | 21.34 | 19.82 | NA |
| 2007-03-01 | 17.50 | 17.88 | 18.408 | 20.12 | 19.12 | NA |
| 2007-06-01 | 17.50 | 17.70 | 18.336 | 18.73 | 17.50 | NA |
| 2007-09-01 | 17.42 | 17.44 | 18.008 | 17.75 | 17.32 | NA |
| 2007-12-01 | 16.25 | 16.56 | 16.487 | 16.44 | 16.09 | NA |
| 2008-03-01 | 15.33 | 15.86 | 15.552 | 17.01 | 17.59 | NA |
| 2008-06-01 | 15.75 | 16.18 | 16.509 | 19.95 | 20.28 | NA |
| 2008-09-01 | 16.75 | 17.06 | 17.069 | 19.72 | 19.64 | NA |
| 2008-12-01 | 16.00 | 17.70 | 16.451 | 20.50 | 22.06 | NA |
| 2009-03-01 | 11.67 | 13.16 | 12.508 | 15.16 | 16.69 | NA |
| 2009-06-01 | 9.25 | 10.63 | 9.399 | 12.47 | 13.96 | NA |
| 2009-09-01 | 7.75 | 9.38 | 7.878 | 10.26 | 11.79 | NA |
| 2009-12-01 | 6.58 | 7.61 | 6.542 | 8.76 | 10.21 | NA |
| 2010-03-01 | 6.50 | 7.42 | 6.340 | 8.92 | 10.45 | 10.66 |
| 2010-06-01 | 7.00 | 7.68 | 6.276 | 9.06 | 9.98 | 10.52 |
| 2010-09-01 | 7.00 | 7.52 | 6.514 | 8.24 | 8.95 | 9.14 |
| 2010-12-01 | 6.83 | 7.26 | 5.909 | 7.61 | 8.29 | 8.72 |
| 2011-03-01 | 6.31 | 6.73 | 5.589 | 8.25 | 9.01 | 9.38 |
| 2011-06-01 | 6.26 | 6.89 | 6.576 | 8.77 | 9.31 | 9.46 |
| 2011-09-01 | 5.96 | 7.00 | 6.502 | 8.40 | 9.00 | 9.39 |
| 2011-12-01 | 6.84 | 7.70 | 7.859 | 9.89 | 9.96 | 9.80 |
| 2012-03-01 | 8.22 | 8.84 | 8.754 | 9.79 | 9.78 | 9.70 |
| 2012-06-01 | 9.23 | 9.06 | 8.895 | 9.31 | 9.24 | 9.28 |
| 2012-09-01 | 7.02 | 8.21 | 5.976 | 7.71 | 8.02 | 8.35 |
| 2012-12-01 | 5.68 | 6.85 | 4.828 | 6.57 | 6.92 | 7.46 |
| 2013-03-01 | 5.57 | 6.06 | 4.798 | 5.92 | 6.40 | 6.90 |
| 2013-06-01 | 5.12 | 5.43 | 4.581 | 5.93 | 6.58 | 6.92 |
| 2013-09-01 | 6.05 | 6.55 | 6.845 | 8.94 | 9.10 | 9.33 |
| 2013-12-01 | 6.55 | 6.84 | 6.819 | 8.75 | 9.03 | 9.29 |
| 2014-03-01 | 9.22 | 8.63 | 10.215 | 10.80 | 10.67 | 10.43 |
| 2014-06-01 | 9.79 | 9.29 | 9.271 | 9.12 | 9.22 | 9.45 |
| 2014-09-01 | 8.40 | 8.10 | 8.090 | 8.92 | 8.99 | 9.21 |
| 2014-12-01 | 8.40 | 8.26 | 8.443 | 8.46 | 8.44 | 8.58 |
| 2015-03-01 | 7.99 | 8.55 | 9.062 | 8.04 | 7.70 | 7.81 |
| 2015-06-01 | 8.26 | 9.03 | 10.526 | 9.71 | 9.15 | 9.14 |
| 2015-09-01 | 8.66 | 9.43 | 10.941 | 10.55 | 10.29 | 10.05 |
| 2015-12-01 | 8.78 | 9.74 | 10.732 | 10.59 | 10.51 | 10.25 |
| 2016-03-01 | 8.98 | 9.94 | 10.747 | 10.86 | 10.72 | 10.68 |
| 2016-06-01 | 8.50 | 9.66 | 9.886 | 9.37 | 9.53 | 9.68 |
| 2016-09-01 | 7.98 | 9.04 | 8.466 | 8.78 | 9.43 | 9.63 |
| 2016-12-01 | 7.98 | 8.85 | 8.274 | 9.91 | 10.48 | 10.68 |
| 2017-03-01 | 10.10 | 8.81 | 10.522 | 11.30 | 11.25 | 11.11 |
| 2017-06-01 | 11.80 | 10.15 | 11.384 | 11.27 | 10.87 | 10.63 |
| 2017-09-01 | 11.97 | 10.86 | 11.623 | 11.59 | 10.93 | 10.71 |
| 2017-12-01 | 12.17 | 11.17 | 12.022 | 13.14 | 12.55 | 11.98 |
| 2018-03-01 | 12.75 | 11.39 | 12.362 | 13.41 | 12.63 | 12.13 |
| 2018-06-01 | 14.82 | 12.70 | 14.796 | 16.52 | 15.25 | 14.38 |
| 2018-09-01 | 19.29 | 17.53 | 21.954 | 24.10 | 22.74 | 19.46 |
| 2018-12-01 | 24.00 | 22.09 | 23.980 | 22.65 | 19.55 | 17.73 |
| 2019-03-01 | 24.07 | 19.58 | 25.750 | 18.79 | 17.03 | 15.76 |
| 2019-06-01 | 24.34 | 21.44 | 25.147 | 22.51 | 21.75 | 18.60 |
| 2019-09-01 | 20.31 | 17.87 | 17.586 | 16.19 | 16.07 | 15.78 |
| 2019-12-01 | 14.04 | 11.65 | 12.394 | 12.60 | 13.01 | 13.03 |
# Ploting
ggplot(data_subset, aes(x = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`, y = `Turkey Average Deposit Rate (1m)`)) +
geom_point(size = 3, color = "blue") +
labs(title = "Policy Rate vs. Average Deposit Rate",
x = "Policy Rate", y = "Average Deposit Rate") +
theme_minimal()
ggplot(data_subset, aes(x = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`, y = `Turkey Implied Yield (1-month, %)`)) +
geom_point(size = 3, color = "red") +
labs(title = "Policy Rate vs. Implied Yield",
x = "Policy Rate", y = "Implied Yield") +
theme_minimal()
ggplot(data_subset, aes(x = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`, y = `Turkey 2yr Bond Yield`)) +
geom_point(size = 3, color = "green") +
labs(title = "Policy Rate vs. 2-year Bond Yield",
x = "Policy Rate", y = "2-year Bond Yield") +
theme_minimal()
ggplot(data_subset, aes(x = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`, y = `Turkey 5yr Bond Yield`)) +
geom_point(size = 3, color = "purple") +
labs(title = "Policy Rate vs. 5-year Bond Yield",
x = "Policy Rate", y = "5-year Bond Yield") +
theme_minimal()
ggplot(data_subset, aes(x = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`, y = `Turkey 10yr Bond Yield`)) +
geom_point(size = 3, color = "orange") +
labs(title = "Policy Rate vs. 10-year Bond Yield",
x = "Policy Rate", y = "10-year Bond Yield") +
theme_minimal()
# correlations
correlation_deposit = cor(data_subset$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`, data_subset$`Turkey Average Deposit Rate (1m)`)
correlation_yield = cor(data_subset$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`, data_subset$`Turkey Implied Yield (1-month, %)`)
correlation_2yr = cor(data_subset$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`, data_subset$`Turkey 2yr Bond Yield`)
correlation_5yr = cor(data_subset$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`, data_subset$`Turkey 5yr Bond Yield`)
correlation_10yr = cor(data_subset$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`, data_subset$`Turkey 10yr Bond Yield`)
correlation_table = data.frame(Key_Interest_Rate = c("Average Deposit Rate", "Implied Yield", "2-year Bond Yield", "5-year Bond Yield", "10-year Bond Yield"),
Correlation = c(correlation_deposit, correlation_yield, correlation_2yr, correlation_5yr, correlation_10yr))
# Print
kable(correlation_table, col.names = c("Key Interest Rate", "Correlation"))
|Key Interest Rate | Correlation| |:--------------------|-----------:| |Average Deposit Rate | 0.9627876| |Implied Yield | 0.6916735| |2-year Bond Yield | 0.8742255| |5-year Bond Yield | 0.8134219| |10-year Bond Yield | 0.7884227|
These correlations represent the strength and direction of the linear relationship between the policy rate and the respective variables. A $correlation$ value of $1$ indicates a perfect positive linear relationship, $-1$ indicates a perfect negative linear relationship, and $0$ indicates no linear relationship.
# policy rate and deposit rate
plot(data$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`, data$`Turkey Average Deposit Rate (1m)`,
xlab = "Policy Rate",
ylab = "Deposit Rate",
main = "Scatter Plot: Policy Rate vs. Deposit Rate")
# Linear regression between policy rate and yield
model = lm(`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)` ~ `Turkey Implied Yield (1-month, %)`, data = data)
summary(model)
Call:
lm(formula = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)` ~
`Turkey Implied Yield (1-month, %)`, data = data)
Residuals:
Min 1Q Median 3Q Max
-10.4038 -1.9149 -0.7269 2.6776 7.4151
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.51529 0.88967 6.199 4.18e-08 ***
`Turkey Implied Yield (1-month, %)` 0.46162 0.05694 8.108 1.70e-11 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 3.563 on 66 degrees of freedom
(20 observations deleted due to missingness)
Multiple R-squared: 0.499, Adjusted R-squared: 0.4914
F-statistic: 65.74 on 1 and 66 DF, p-value: 1.698e-11
According to analysis, the coefficient estimate for Turkey Implied Yield (1-month, %) is positive and statistically significant (p-value < 0.001). This indicates that there is a positive linear relationship between the Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate, and ON borrowing rate) and Turkey Implied Yield (1-month, %). As Turkey Implied Yield (1-month, %) increases, the Turkey Policy Rate is expected to increase as well.Therefore, based on the results of the linear regression analysis, it suggests that the policy rate should be set higher when Turkey Implied Yield (1-month, %) is higher, and vice versa. However, it is important to consider other factors and variables that may influence the policy rate decision, such as inflation, economic growth, monetary policy goals, and external factors,before making any final decision on setting the policy rate. It is always recommended to consult with economic experts and policymakers for a comprehensive and informed decision-making process.
# Rename the column names to remove special characters and spaces
colnames(data) = c("Date", "CDS_Turkey_5yr", "Turkey_Policy_Rate", "USDTRY", "Turkey_Average_Deposit_Rate", "Turkey_Implied_Yield", "Turkey_CPI_YoY", "Turkey_12m_Inflation_Expectations", "Average_CDS_Emerging_Markets_5yr", "VIX", "BAA_Spread_10yr", "US_10yr_Treasury_Bond_Yield", "US_2yr_Treasury_Bond_Yield", "US_Policy_Rate", "US_CPI_YoY", "Fed_ECB_Balance_Sheet_Total_Size", "Current_Account_Balance", "Identified_Inflows", "Financial_Account_Inflows", "FDI_Inflows", "Portfolio_Inflows", "Other_Investment_Net_Inflows", "Errors_Omissions", "Reserve_Assets", "Turkey_Nominal_GDP", "Turkey_GDP_Level", "Turkey_GDP_Growth_YoY", "Turkey_2yr_Bond_Yield", "Turkey_5yr_Bond_Yield", "Turkey_10yr_Bond_Yield", "Turkey_Average_Commercial_Loan_Rate", "Turkey_Average_Consumer_Loan_Rate", "Turkey_CPI_REER", "Turkey_Household_FX_Deposits", "Turkey_Corporates_FX_Deposits")
# Perform linear regression
reg_model = lm(CDS_Turkey_5yr ~ Turkey_Policy_Rate, data = data)
#summary of the regression model
summary(reg_model)
Call:
lm(formula = CDS_Turkey_5yr ~ Turkey_Policy_Rate, data = data)
Residuals:
Min 1Q Median 3Q Max
-188.33 -73.46 -24.00 30.32 480.70
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 162.097 41.157 3.939 0.0002 ***
Turkey_Policy_Rate 10.185 3.211 3.172 0.0023 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 131.3 on 66 degrees of freedom
(20 observations deleted due to missingness)
Multiple R-squared: 0.1323, Adjusted R-squared: 0.1192
F-statistic: 10.06 on 1 and 66 DF, p-value: 0.002296
Based on the results of the linear regression analysis, the coefficient estimate for the "Turkey_Policy_Rate" variable is positive (10.185) with a statistically significant p-value (0.0023), indicating that there may be a positive relationship between the "Turkey_Policy_Rate" and the "CDS of Turkey (5yr)".However, it's important to note that the R-squared value is relatively low (0.1323), which means that only about 13.23% of the variability in the "CDS of Turkey (5yr)" can be explained by the "Turkey_Policy_Rate" alone. This suggests that other factors not included in the model may also be influencing the "CDS of Turkey (5yr)".Based on the coefficient estimate of 10.185 for the "Turkey_Policy_Rate" variable from the linear regression analysis, and assuming all other factors remain constant, a one-unit increase in the "Turkey_Policy_Rate" would be associated with an estimated increase of 10.185 units in the "CDS of Turkey (5yr)". Similarly, a one-unit decrease in the "Turkey_Policy_Rate" would be associated with an estimated decrease of 10.185 units in the "CDS of Turkey (5yr)".However, it's important to note that this relationship is based solely on the results of the linear regression analysis and may not necessarily reflect the actual behavior of the "CDS of Turkey (5yr)" in reality. There may be other factors at play that are not accounted for in the model, and the relationship may be subject to change over time. It's always recommended to interpret the results of any statistical analysis with caution and consider other relevant factors before making any definitive conclusions about the direction or magnitude of change in a particular variable.
data$Date = as.Date(data$Date)
data_subset = data[, c("Date", "CDS_Turkey_5yr")] # Update column name
data_subset = na.omit(data_subset)
cds_ts = ts(data_subset$CDS_Turkey_5yr, frequency = 12, start = c(year(min(data_subset$Date)), month(min(data_subset$Date))))
arima_model = auto.arima(cds_ts)
cds_forecast = forecast(arima_model, h = 12) # h = 12 for 1 year ahead forecast
print(cds_forecast)
Point Forecast Lo 80 Hi 80 Lo 95 Hi 95 Nov 2011 611.75 522.8208 700.6792 475.7446 747.7554 Dec 2011 611.75 485.9852 737.5148 419.4093 804.0907 Jan 2012 611.75 457.7201 765.7799 376.1817 847.3183 Feb 2012 611.75 433.8916 789.6084 339.7391 883.7609 Mar 2012 611.75 412.8983 810.6017 307.6326 915.8674 Apr 2012 611.75 393.9189 829.5811 278.6061 944.8939 May 2012 611.75 376.4655 847.0345 251.9134 971.5866 Jun 2012 611.75 360.2203 863.2797 227.0685 996.4315 Jul 2012 611.75 344.9625 878.5375 203.7337 1019.7663 Aug 2012 611.75 330.5313 892.9687 181.6630 1041.8370 Sep 2012 611.75 316.8053 906.6947 160.6710 1062.8290 Oct 2012 611.75 303.6903 919.8097 140.6133 1082.8867
The cds_forecast object contains the point forecasts (i.e., the expected values) for the CDS_Turkey_5yr time series for each forecasted time period, as well as the lower and upper bounds of the forecast intervals at 80% and 95% confidence levels. For example, the forecasted point estimate for November 2011 is 611.75, with a lower bound of 522.8208 and an upper bound of 700.6792 at the 80% confidence level. Similarly, at the 95% confidence level, the lower bound is 475.7446 and the upper bound is 747.7554.The forecasted values continue for each subsequent time period (December 2011 to October 2012) with corresponding point estimates and forecast intervals at 80% and 95% confidence levels.
inflows = data %>% select("Date", "Identified Inflows", "CDS of Turkey (5yr)")
# Convert column to date format
inflows$Date = as.Date(inflows$Date)
inflows_quarterly = inflows %>% filter(format(Date, "%m") %in% c("03", "06", "09", "12"))
# Perform simple linear regression
lm_model = lm(`Identified Inflows` ~ `CDS of Turkey (5yr)`, data = inflows_quarterly)
summary(lm_model)
In this example, we are regressing "$Identified\ Inflows$" on "$CDS\ of\ Turkey\ (5yr)$" using quarterly data. The "summary" function provides the estimated coefficients, standard errors, t-values, and p-values for the regression model.
Multiple R-squared and Adjusted R-squared: These are measures of the goodness of fit of the model. Multiple R-squared represents the proportion of variance in the dependent variable that is explained by the independent variable(s), while Adjusted $R-squared$ takes into account the number of independent variables in the model. In this case, the $Multiple\ R-squared$ is $0.1744$ and the Adjusted $R-squared$ is $0.1619$, indicating that about $17.44\%$ of the variance in Identified Inflows can be explained by $CDS\ of\ Turkey\ (5yr)$
Coefficients: These are the estimated coefficients of the linear regression model. The intercept term is estimated to be 15.408249 with a standard error of 2.191512, and the coefficient for $CDS\ of\ Turkey\ (5yr)$ is estimated to be -0.025998 with a standard error of 0.006962. The t-value and p-value are also shown, which can be used to assess the significance of the coefficients. In this case, the intercept term and $CDS\ of\ Turkey\ (5yr)$ coefficient are both statistically significant with p-values less than 0.001 and 0.01, respectively, indicating that they are likely to be different from zero.
Since the coefficient for $CDS\ of\ Turkey\ (5yr)$ is negative, this suggests that an increase in the value of the $CDS\ of\ Turkey\ (5yr)$ variable (which represents the credit default swap spread for Turkey over a 5-year period) is associated with a decrease in the Identified Inflows variable (which represents inflows). In other words, when the credit default swap spread for Turkey increases, it is likely to lead to a decrease in inflows.
ggplot(data, aes(x = Date, y = USDTRY)) +
geom_line(color = "blue", na.rm = TRUE) +
labs(x = "Date", y = "USDTRY Exchange Rate", title = "USDTRY Exchange Rate Over Time")
# Create a scatter plot
ggplot(data, aes(x = `Turkey CPI (%YoY)`, y = `Turkey GDP Growth (%YoY, NSA)`)) +
geom_point(na.rm = TRUE) +
labs(x = "Turkey CPI (%YoY)", y = "Turkey GDP Growth (%YoY, NSA)", title = "Scatter Plot of Turkey CPI vs. GDP Growth")
# Create a scatter plot of Turkey CPI against Turkey GDP
ggplot(data, aes(x = `Turkey CPI (%YoY)`, y = `Turkey GDP Growth (%YoY, NSA)`)) +
geom_point(na.rm = TRUE) +
labs(x = "Turkey CPI (%YoY)", y = "Turkey GDP Growth (%YoY, NSA)", title = "Scatter Plot of Turkey CPI vs. GDP Growth")
# Remove rows with missing values from the data
data_clean = data[complete.cases(data), ]
# Create a bar chart of average funding rate, one-week repo rate, and ON borrowing rate with missing values removed for plotting
ggplot(data_clean, aes(x = Date, y = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`)) +
geom_col(fill = "blue") +
labs(x = "Date", y = "Turkey Policy Rate", title = "Average Funding Rate, One-Week Repo Rate, and ON Borrowing Rate Over Time")
data_filtered = data %>%
filter(!is.na(USDTRY) & !is.na(`CDS of Turkey (5yr)`))
# Create scatter plot
ggplot(data_filtered, aes(x = `CDS of Turkey (5yr)`, y = USDTRY)) +
geom_point() +
labs(x = "CDS of Turkey (5yr)", y = "USDTRY", title = "Scatter Plot of CDS vs. USDTRY") +
theme_minimal()
# Perform linear regression
regression_model = lm(USDTRY ~ `CDS of Turkey (5yr)`, data = data_filtered)
summary(regression_model)
Call:
lm(formula = USDTRY ~ `CDS of Turkey (5yr)`, data = data_filtered)
Residuals:
Min 1Q Median 3Q Max
-7.2475 -0.8974 0.0619 1.0620 6.7563
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -2.839358 0.548710 -5.175 2.32e-06 ***
`CDS of Turkey (5yr)` 0.024016 0.001743 13.777 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.996 on 66 degrees of freedom
Multiple R-squared: 0.742, Adjusted R-squared: 0.7381
F-statistic: 189.8 on 1 and 66 DF, p-value: < 2.2e-16
The regression analysis results for "USDTRY" against "CDS of Turkey (5yr)" are as follows: Intercept (Intercept): Estimate = -2.839358, Std. Error = 0.548710, t-value = -5.175, p-value = 2.32e-06 (highly significant) Coefficient for "CDS of Turkey (5yr)" (CDS of Turkey (5yr)): Estimate = 0.024016, Std. Error = 0.001743, t-value = 13.777, p-value < 2e-16 (highly significant)
The R-squared value of the model is 0.742, which indicates that approximately 74.2% of the variability in "USDTRY" can be explained by the linear relationship with "CDS of Turkey (5yr)".
data = ts(data[, c("Date", "USDTRY", "CDS of Turkey (5yr)")], frequency = 4, start = c(2006, 1))
data = head(data, 56)
data
| Date | USDTRY | CDS of Turkey (5yr) | |
|---|---|---|---|
| 2006 Q1 | 1141171200 | 1.3330 | 143.966 |
| 2006 Q2 | 1149120000 | 1.4631 | 197.459 |
| 2006 Q3 | 1157068800 | 1.4989 | 221.261 |
| 2006 Q4 | 1164931200 | 1.4554 | 182.813 |
| 2007 Q1 | 1172707200 | 1.4109 | 168.769 |
| 2007 Q2 | 1180656000 | 1.3382 | 152.005 |
| 2007 Q3 | 1188604800 | 1.2863 | 186.107 |
| 2007 Q4 | 1196467200 | 1.1902 | 175.513 |
| 2008 Q1 | 1204329600 | 1.2056 | 233.730 |
| 2008 Q2 | 1212278400 | 1.2616 | 264.107 |
| 2008 Q3 | 1220227200 | 1.2128 | 287.686 |
| 2008 Q4 | 1228089600 | 1.5390 | 484.089 |
| 2009 Q1 | 1235865600 | 1.6590 | 436.488 |
| 2009 Q2 | 1243814400 | 1.5686 | 290.382 |
| 2009 Q3 | 1251763200 | 1.4984 | 219.885 |
| 2009 Q4 | 1259625600 | 1.4910 | 188.671 |
| 2010 Q1 | 1267401600 | 1.5094 | 180.187 |
| 2010 Q2 | 1275350400 | 1.5418 | 180.981 |
| 2010 Q3 | 1283299200 | 1.5135 | 168.900 |
| 2010 Q4 | 1291161600 | 1.4662 | 136.576 |
| 2011 Q1 | 1298937600 | 1.5774 | 159.336 |
| 2011 Q2 | 1306886400 | 1.5676 | 160.331 |
| 2011 Q3 | 1314835200 | 1.7383 | 228.136 |
| 2011 Q4 | 1322697600 | 1.8393 | 272.135 |
| 2012 Q1 | 1330560000 | 1.7963 | 261.790 |
| 2012 Q2 | 1338508800 | 1.8070 | 251.891 |
| 2012 Q3 | 1346457600 | 1.8033 | 184.495 |
| 2012 Q4 | 1354320000 | 1.7944 | 144.172 |
| 2013 Q1 | 1362096000 | 1.7854 | 131.605 |
| 2013 Q2 | 1370044800 | 1.8392 | 140.814 |
| 2013 Q3 | 1377993600 | 1.9686 | 211.426 |
| 2013 Q4 | 1385856000 | 2.0251 | 200.302 |
| 2014 Q1 | 1393632000 | 2.2141 | 243.708 |
| 2014 Q2 | 1401580800 | 2.1115 | 188.236 |
| 2014 Q3 | 1409529600 | 2.1637 | 183.400 |
| 2014 Q4 | 1417392000 | 2.2624 | 181.410 |
| 2015 Q1 | 1425168000 | 2.4642 | 196.705 |
| 2015 Q2 | 1433116800 | 2.6650 | 220.213 |
| 2015 Q3 | 1441065600 | 2.8557 | 256.919 |
| 2015 Q4 | 1448928000 | 2.9074 | 263.932 |
| 2016 Q1 | 1456790400 | 2.9413 | 286.035 |
| 2016 Q2 | 1464739200 | 2.8977 | 257.893 |
| 2016 Q3 | 1472688000 | 2.9666 | 250.135 |
| 2016 Q4 | 1480550400 | 3.2936 | 273.265 |
| 2017 Q1 | 1488326400 | 3.6945 | 253.462 |
| 2017 Q2 | 1496275200 | 3.5771 | 207.918 |
| 2017 Q3 | 1504224000 | 3.5130 | 179.286 |
| 2017 Q4 | 1512086400 | 3.8022 | 188.091 |
| 2018 Q1 | 1519862400 | 3.8172 | 172.171 |
| 2018 Q2 | 1527811200 | 4.3740 | 249.399 |
| 2018 Q3 | 1535760000 | 5.6586 | 407.471 |
| 2018 Q4 | 1543622400 | 5.4996 | 384.537 |
| 2019 Q1 | 1551398400 | 5.3644 | 338.686 |
| 2019 Q2 | 1559347200 | 5.8726 | 457.103 |
| 2019 Q3 | 1567296000 | 5.6749 | 389.385 |
| 2019 Q4 | 1575158400 | 5.7994 | 330.440 |
lag_order <- c(2, 1) # Lag order 2 for "USDTRY" and lag order 1 for "CDS of Turkey (5yr)"
var_model <- VAR(data, p = max(lag_order), type = "none", lag.max = max(lag_order))
granger_test <- causality(var_model, cause = "CDS.of.Turkey..5yr.")
# Granger causality test
granger_test = causality(var_model, cause = "CDS.of.Turkey..5yr.")
print(granger_test)
$Granger Granger causality H0: CDS.of.Turkey..5yr. do not Granger-cause Date USDTRY data: VAR object var_model F-Test = 0.75171, df1 = 4, df2 = 144, p-value = 0.5584 $Instant H0: No instantaneous causality between: CDS.of.Turkey..5yr. and Date USDTRY data: VAR object var_model Chi-squared = 18.19, df = 2, p-value = 0.0001122
granger_pvalues = granger_test$Granger$p.value
# plotting
plot_data = data.frame(Date = time(data),
USDTRY = as.vector(data[, "USDTRY"]),
CDS_Turkey_5yr = as.vector(data[, "CDS of Turkey (5yr)"]),
Granger_Pvalue = as.vector(granger_pvalues))
# time series plot
ggplot(plot_data, aes(x = USDTRY, y = CDS_Turkey_5yr)) +
geom_point(color = "steelblue") +
geom_text(aes(label = ifelse(Granger_Pvalue < 0.05, "*", "")),
vjust = -1, hjust = 4, size = 20) +
labs(x = "USDTRY", y = "CDS of Turkey (5yr)", title = "Granger Causality Test Results") +
theme_minimal()
This code performs a Granger causality test for the direction of causality between "CDS of Turkey (5yr)" and "USDTRY" using a Vector Autoregression (VAR) model with the specified lag orders. The results will be printed, showing the p-value for the Granger causality test, where a p-value less than a chosen significance level (e.g., 0.05) indicates evidence of Granger causality. You can modify the cause and effect parameters in the causality() function to perform Granger causality tests for different pairs of variables in your data object.
According to our on the results, the p-value for the instantaneous causality test is 0.0001122, which is less than the chosen significance level of 0.05. This suggests that there is evidence of instantaneous causality between "CDS of Turkey (5yr)" and "USDTRY" in the VAR model.
First of all, before we make an estimate for USDTRY, we can say that some indicators are in a direct relationship with USDTRY, therefore, if CDS values decrease (250bps or 300bps), we can think that a capital close to 40-50 billion dollars can enter Turkey in the 12-month term. We used the Granger Causality model to explain the relationship between CDS and USDTRY. In addition, we need to examine the policy rate that directly affects the USDTRY (For this, the upcoming elections in Turkey, statistics may be an indicator beyond the models for us.) A clear relationship between USDTRY and the policy rate is clearly seen with the past statistical models. In such a scenario, we can say that TL can appreciate by 12-15% in case the policy rate is 21-22 within a 12-month maturity.
data$Date = as.Date(data$Date)
ts_data = ts(data[, c("USDTRY", "Turkey 12-month ahead inflation expectations")],
start = min(data$Date), end = max(data$Date), frequency = 1)
plot_data = data.frame(Date = time(ts_data),
USDTRY = as.vector(ts_data[, "USDTRY"]),
Inflation_Expectations = as.vector(ts_data[, "Turkey 12-month ahead inflation expectations"]))
ggplot(plot_data, aes(x = USDTRY, y = Inflation_Expectations)) +
geom_point(color = "steelblue") +
labs(x = "USDTRY", y = "Turkey 12-month ahead Inflation Expectations",
title = "USDTRY vs. Turkey 12-month Ahead Inflation Expectations") +
theme_minimal()
data$Date = as.Date(data$Date)
plot_data = data.frame(Date = data$Date,
USDTRY = data$USDTRY,
Inflation_Expectations = data$`Turkey 12-month ahead inflation expectations`)
ggplot(plot_data, aes(x = Date)) +
geom_line(aes(y = USDTRY, color = "USDTRY")) +
geom_line(aes(y = Inflation_Expectations, color = "Inflation Expectations")) +
labs(x = "Date", y = "Value",
title = "USDTRY vs. Turkey 12-month Ahead Inflation Expectations") +
theme_minimal() +
scale_color_manual(name = "Variable",
values = c("USDTRY" = "steelblue", "Inflation Expectations" = "red"))
#regression model
model = lm(`Turkey 12-month ahead inflation expectations` ~ USDTRY, data = data)
#summary
summary(model)
Call:
lm(formula = `Turkey 12-month ahead inflation expectations` ~
USDTRY, data = data)
Residuals:
Min 1Q Median 3Q Max
-2.4213 -0.7288 -0.0833 0.3965 4.4250
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.1647 0.3422 12.17 <2e-16 ***
USDTRY 1.5220 0.1216 12.52 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.226 on 54 degrees of freedom
Multiple R-squared: 0.7437, Adjusted R-squared: 0.739
F-statistic: 156.7 on 1 and 54 DF, p-value: < 2.2e-16
R-squared: The R-squared value is 0.7437, which means that approximately 74.37% of the variability in Turkey's 12-month ahead inflation expectations can be explained by the linear relationship with USDTRY.
I think, the linear regression analysis suggests that there is a statistically significant positive relationship between USDTRY and Turkey's 12-month ahead inflation expectations, with USDTRY being a significant predictor of inflation expectations. However, it's important to consider other factors and assumptions of linear regression when interpreting the results and making conclusions
ggplot(data, aes(x = USDTRY, y = `Turkey 12-month ahead inflation expectations`)) +
geom_point(color = "steelblue") +
geom_smooth(method = "lm", se = FALSE, color = "red", linetype = "solid", linewidth = 1) +
labs(x = "USDTRY", y = "Turkey 12-month ahead Inflation Expectations",
title = "USDTRY vs. Turkey 12-month Ahead Inflation Expectations (Linear Regression)") +
theme_minimal()
Positive correlation, we can say that the scatter plot and the positive slope of the regression line suggest that there may be a positive linear relationship between USDTRY and inflation expectations. This means that as USDTRY increases, inflation expectations tend to increase as well.
We have seen that the relationship between these variables is clear so that we can forecast inflation, and now a 12-month inflation expectation statement can be made with a comment on the future value of the USDTRY for a future inflation forecast. Therefore, we need to analyze the situation of the factors that directly affect USDTRY (such as CDS, policy rate). It can be clearly interpreted that it will rise with orthodox policies. Therefore, in summary, assuming that CDS will stay the same and the policy rate will stay the same or decrease, USDTRY will depreciate at least 10-15% in a 12-month period. In this case, the effect on inflation will be negative. As we can see in the charts and our analysis, it is clear that there is a positive correlation with USDTRY and inflation expectation (or inflation itself). If CDS experiences a decrease of 250-300bps (which depends on the policy rate). We can see a positive trend of 12-15% in USDTRY in a 12-month period. Of course, we can provide an empirical proof of this (I don't think so, regression analysis and graphs show this clearly).
data$Date = as.Date(data$Date)
#USDTRY
plot_usdtry = ggplot(data, aes(x = Date, y = USDTRY)) +
geom_line(color = "steelblue") +
labs(x = "Date", y = "USDTRY", title = "USDTRY") +
theme_minimal()
# CDS
plot_cds_turkey = ggplot(data, aes(x = Date, y = `CDS of Turkey (5yr)`)) +
geom_line(color = "red") +
labs(x = "Date", y = "CDS of Turkey (5yr)", title = "CDS of Turkey (5yr)") +
theme_minimal()
# Policy Rate
plot_policy_rate = ggplot(data, aes(x = Date, y = `Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`)) +
geom_line(color = "green") +
labs(x = "Date", y = "Turkey Policy Rate", title = "Turkey Policy Rate") +
theme_minimal()
grid.arrange(plot_usdtry, plot_cds_turkey, plot_policy_rate, ncol = 1)
Looking at the historical analysis, our graph clearly shows the correlation.
usdtry = data$USDTRY
cds = data$`CDS of Turkey (5yr)`
policy_rate = data$`Turkey Policy Rate (Merged series of Avg funding rate, one-week repo rate and ON borrowing rate)`
gdp_growth = data$`Turkey GDP Growth (%YoY, NSA)`
usdtry_stats = summary(usdtry)
cds_stats = summary(cds)
policy_rate_stats = summary(policy_rate)
gdp_growth_stats = summary(gdp_growth)
correlation = cor(data.frame(USDTRY = usdtry, CDS = cds, Policy_Rate = policy_rate, GDP_Growth = gdp_growth))
cat("USDTRY Descriptive Statistics:\n")
print(usdtry_stats)
cat("\nCDS of Turkey (5yr) Descriptive Statistics:\n")
print(cds_stats)
cat("\nTurkey Policy Rate Descriptive Statistics:\n")
print(policy_rate_stats)
cat("\nTurkey GDP Growth Descriptive Statistics:\n")
print(gdp_growth_stats)
cat("\nCorrelation Coefficients:\n")
corrplot(correlation, method = "number")
USDTRY Descriptive Statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 1.190 1.507 1.823 2.471 2.948 5.873 CDS of Turkey (5yr) Descriptive Statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 131.6 180.8 215.7 235.8 264.0 484.1 Turkey Policy Rate Descriptive Statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. 5.120 7.015 9.225 11.408 15.435 24.340 Turkey GDP Growth Descriptive Statistics: Min. 1st Qu. Median Mean 3rd Qu. Max. -14.540 3.165 5.635 4.795 7.713 11.800 Correlation Coefficients:
According to this analysis a positive correlation between two variables means that as one variable increases, the other tends to increase as well. A correlation coefficient close to 1 indicates a strong positive correlation, while a value closer to 0 indicates a weaker positive correlation.
All our statistical analyzes and graphs show a correlation between variables. Therefore, we need to analyze the relationships between correlations well and explain the reasons for a policy rate or an inflation that will provide an appropriate growth.
So, with the analysis that we are doing right now and when we analyze the current situation of the country, we need inflation to come down in order to provide the appropriate growth environment, we need 250-300bps CDS points to come down for that, we need an increase in the policy rate for that to come down. Therefore, we can say that the policy rate could be around 20% within 12 months, in line with market expectations. If the policy rate is 20%, there could be a drop of about 250-300bps in the CDS, which means that the TL could appreciate by 15% from the top with foreign capital. The effect of all of these would be to reduce inflation and the GDP Growth Rate would rise and a favorable growth could be achieved. (We can say that the upcoming elections in Turkey will directly affect this and the policy rate will increase in a possible election and change of government. also, a 12-month forecast can be made with the values we mentioned.)
If the opposite happens and the policy rate stays the same or declines, the opposite scenario will occur and it will be difficult to achieve a favorable growth environment in 12 months. Also, the CDS and other parameters like inflation will be negatively affected.
More parameters can be added to the ones we have mentioned and their correlations can be analyzed by regression or other statistical methods. But for this study I did not need to go any further, the parameters I have discussed are sufficient to answer your questions.